package me.cloudcat.develop.dao.base;

import java.io.Serializable;

import javax.persistence.EntityManager;

import org.springframework.data.jpa.repository.support.SimpleJpaRepository;
import org.springframework.data.repository.NoRepositoryBean;

/**
 * 全局dao接口实现
 * 
 * @author ZZWang
 * @Time 2017年1月17日 下午3:07:18
 *
 */
@NoRepositoryBean
public class BaseRepositoryImpl<T, ID extends Serializable> extends SimpleJpaRepository<T, ID> implements BaseRepository<T, ID> {

	private final EntityManager entityManager;
	private final Class<T> domainClass;

	public BaseRepositoryImpl(Class<T> domainClass, EntityManager entityManager) {
		super(domainClass, entityManager);

		// This is the recommended method for accessing inherited class
		// dependencies.
		this.domainClass = domainClass;
		this.entityManager = entityManager;
	}
	
	


	public boolean support(String modelType) {
		return domainClass.getName().equals(modelType);
    }


}
